const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackBar = require('webpackbar');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  },
  devServer: {
    contentBase: path.resolve(__dirname, 'dist'),
    historyApiFallback: true,
    proxy: {
      '/api': {
        target: 'https://pvp.qq.com/',
        changeOrigin: true,
        pathRewrite: { '^/api': '' },
      },
    },
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /(node_modules)/,
        use: {
          loader: 'babel-loader',
        }
      }
    ]
  },
  plugins: [
    new WebpackBar(),

    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, "public/index.html"),
      chunksSortMode: 'none'
    }),

  ],

  stats: {
    modules: false,
    children: false,
    chunks: false,
    chunkModules: false
  },

}
